package com.crhms.seabow.controller;

import com.crhms.seabow.entity.Book;
import com.crhms.seabow.model.BasicData;
import com.crhms.seabow.service.HomeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/home")
public class HomeController {

    @Autowired
    private HomeService homeService;

    @GetMapping("/getBasicInfo")
    public BasicData getBasicInfo(){

        BasicData basicData = new BasicData();
        List<Book> books = homeService.getBooks();
        basicData.setNavList(books);


        return basicData;

    }
}
